# Install Apache
# Date: 2013-12-30
Apache_Install() {
logs "Info" "Add System User \"www\""
user_add www
logs "Info" "Decompress httpd-${httpdVer}.tar.bz2"
tar -jxf httpd-${httpdVer}.tar.bz2
logs "Info" "Decompress apr and apr-util"
tar -jxf apr-1.5.0.tar.bz2 && mv apr-1.5.0 httpd-${httpdVer}/srclib/apr
tar -jxf apr-util-1.5.3.tar.bz2 && mv apr-util-1.5.3 httpd-$httpdVer/srclib/apr-util
cd httpd-$httpdVer
logs "Info" "Configure Apache"
./configure --prefix=/usr/local/apache \
--enable-so \
--enable-deflate=shared \
--enable-ssl=shared \
--enable-expires=shared  \
--enable-headers=shared \
--enable-rewrite=shared \
--enable-static-support  \
--enable-cgi \
--enable-dav \
--with-included-apr \
--enable-maintainer-mode
logs "Info" "Compile Apache"
make && make install
logs "Info" "Initialize Apache"
mkdir /usr/local/apache/conf/conf.d
#cp conf/lamp/php.conf /usr/local/apache/conf/conf.d/
ln -s /usr/local/apache/conf /etc/httpd
#rm -f /usr/local/apache/conf/httpd.conf
#cp $CWD/conf/lamp/httpd.conf /usr/local/apache/conf/
#echo "include conf/conf.d/*.conf" >> /etc/httpd/httpd.conf
#sed -i 's/User daemon/User www/g' /etc/httpd/httpd.conf
#sed -i 's/Group daemon/Group www/g' /etc/httpd/httpd.conf
cp $CWD/conf/lamp/httpd.init /etc/init.d/httpd
chmod +x /etc/init.d/httpd
chkconfig --add httpd >/dev/null 2>&1 && chkconfig --level 345 httpd on
[ "$?" != "0" ] && echo "/etc/init.d/httpd start" >> /etc/rc.local
#/etc/init.d/httpd start
}
